<template>
  <div>
    <div class="main">
      我的内容
      <van-button type="primary" size="large" @click="handleLogout">退出</van-button>
    </div>
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
      <van-tabbar-item icon="cluster-o" to="/TrackManage">轨道管理</van-tabbar-item>
      <van-tabbar-item icon="bar-chart-o" to="/report">报表</van-tabbar-item>
      <van-tabbar-item icon="user-o" to="/my">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
  import { mapGetters } from "vuex";
  export default {
    name: "my",
    data(){
      return{
        active:3
      }
    },
    computed: {
      ...mapGetters([
        "userInfo",
      ])
    },
    methods:{
      handleLogout(){
        this.$dialog.confirm({
          // title: '标题',
          message: '确认退出么？'
        }).then(() => {
          let userInfo = {
                account:this.userInfo.account,
                nickName:this.userInfo.nick_name,
                userId:this.userInfo.user_id,
                deptId:this.userInfo.dept_id,
              };
              this.$store.dispatch("LogOut",userInfo).then(() => {
                this.$router.push({ path: "/login" });
              });
        }).catch(() => {
          // on cancel
        });
      }
    }
  }
</script>

<style scoped lang="less">

</style>